<?php

use yii\helpers\Html;
use yii\grid\GridView;

/* @var $this yii\web\View */
/* @var $searchModel common\models\qywx\QywxAppSearch */
/* @var $dataProvider yii\data\ActiveDataProvider */

$this->title = Yii::t('app', 'Qywx Apps');
$this->params['breadcrumbs'][] = $this->title;
?>
<div class="qywx-app-index">

    <h1><?= Html::encode($this->title) ?></h1>
    <?php // echo $this->render('_search', ['model' => $searchModel]); ?>

    <p>
        <?= Html::a(Yii::t('app', 'Create Qywx App'), ['create'], ['class' => 'btn btn-success']) ?>
    </p>
    <?= GridView::widget([
        'tableOptions' => ['class' => 'table table-condensed table-bordered table-striped table-hover'],
        'pager'        => [
//            'class'          => GoPager::className(),
            'nextPageLabel'  => '下一页',
            'prevPageLabel'  => '上一页',
            'firstPageLabel' => '首页',
            'lastPageLabel'  => '末页',
            'options'        => [
                'class' => 'pagination pagination-sm m-t-none m-b-none',
            ],
        ],
        'dataProvider' => $dataProvider,
        'filterModel' => $searchModel,
        'columns' => [
            ['class' => 'yii\grid\SerialColumn'],

            'qywx_app_id',
            'qywx_app_name',
            'qywx_app_corp_id',
            'qywx_app_corp_secret',
            'qywx_app_created_by',
             'qywx_app_created_at',
             'qywx_app_updated_by',
             'qywx_app_updated_at',

            [
                'class'         => 'yii\grid\ActionColumn',
                'template'      => '{gen-access-token} {view} {update} {delete}',
                'header'        => '操作',
                'headerOptions' => ['class' => 'text-center no-margin'],
                'buttons'       => [
                    'gen-access-token' => function($url, $model, $key) {
                        $options = [
                            'title' => 'Get Access ',
                            'data-id' => $key,
                        ];
                        return Html::a('<span class="	glyphicon glyphicon-lock edit-class"></span>', $url, $options);
                    },
                ],
            ],
        ],
    ]); ?>
</div>
